package com.hivekion.system.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.hivekion.common.entity.TreeNode;
import com.hivekion.system.domain.SysUser;
import com.hivekion.system.domain.vo.user.SysUserViewVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface SysUserMapper extends BaseMapper<SysUser> {

      IPage<SysUserViewVo> selectUserList(
	      IPage<SysUserViewVo> page, @Param(Constants.WRAPPER) Wrapper queryWrapper);

      /**
       * 校验用户名称是否唯一
       *
       * @param userName 用户名称
       * @return
       */
      SysUser checkUserNameUnique(String userName);

      /**
       * 校验手机号码是否唯一
       *
       * @param phoneNumber 手机号码
       * @return
       */
      SysUser checkPhoneUnique(String phoneNumber);

      /**
       * 校验email是否唯一
       *
       * @param email 用户邮箱
       * @return
       */
      SysUser checkEmailUnique(String email);

      List<String> selectUserPermission(String userId);

      List<SysUserViewVo> selectUserByRoleAndArea(@Param(Constants.WRAPPER) Wrapper queryWrapper);

      List<TreeNode> getStatisticianByArea(String areaCode);
}
